﻿namespace Refract.Data
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;

    using Refract.Event;
    using Refract.MVVM;

    /// <summary>
    /// An interface describing a read only data service
    /// </summary>
    /// <typeparam name="TEntity">The type of the entity.</typeparam>
    /// <typeparam name="TListEntity">The type of the list entity.</typeparam>
    /// <typeparam name="TListModel">The type of the list model.</typeparam>
    public interface IReadOnlyDataService<TEntity, TListEntity, TListModel>
        where TEntity : class, new()
        where TListEntity : IEnumerable<TEntity>, new()
        where TListModel : Model<TListEntity>, new()
    {
        #region Events

        /// <summary>
        /// Occurs when entity list load operation is complete.
        /// </summary>
        event EventHandler<EventArgs<TListEntity>> EntityListLoadComplete;

        /// <summary>
        /// Occurs when entity load operation complete.
        /// </summary>
        event EventHandler<EventArgs<TEntity>> EntityLoadComplete;

        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        event PropertyChangedEventHandler PropertyChanged;

        #endregion Events

        #region Properties

        /// <summary>
        /// Gets or sets a value indicating whether this service is busy.
        /// </summary>
        /// <value><c>true</c> if this instance is busy; otherwise, <c>false</c>.</value>
        bool IsBusy
        {
            get; set;
        }

        /// <summary>
        /// Gets the pending process count.
        /// </summary>
        /// <value>The process count.</value>
        int ProcessCount
        {
            get;
        }

        #endregion Properties

        #region Methods

        /// <summary>
        /// Gets a list of all records for this entity.
        /// </summary>
        /// <returns></returns>
        TListModel GetList();

        #endregion Methods
    }
}